package com.ridanlabs.professorwebsite.models;

import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.DAOBase;

public class DAO extends DAOBase {
	//register db pojo's w/ objectify
	static {
		ObjectifyService.register(UserProfile.class);
		ObjectifyService.register(Course.class);
	}
	
	/*
	 * Helper methods.
	 */
	public UserProfile findUserProfile(String userId) {
		return this.ofy().find(UserProfile.class, userId);
	}
	
	public void saveUserProfile(UserProfile userProfile) {
		this.ofy().put(userProfile);
	}
	
	public Course findCourse(String courseId) {
		return this.ofy().find(Course.class, courseId);
	}
	
	public void saveCourse(Course course) {
		this.ofy().put(course);
	}
}
